//
//  JQFXHRealNamessViewController.swift
//  jiuzhoudai
//
//  Created by 卢小艳 on 2025/7/9.
//

import Foundation
import UIKit
import SnapKit
import CleanJSON


class JQFXHRealNamessViewController: HJYJBaseViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
    
    var jqfxhPartta : [String : String] = [:]
    
    var jqfxhListoos: [JQFXHLoanListuuItemModel] = []

    private func jqfxhIsValidIDNumber(_ idNumber: String) -> Bool {
        let idRegex = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$"
        let idPredicate = NSPredicate(format: "SELF MATCHES %@", idRegex)
        return idPredicate.evaluate(with: idNumber)
    }
    
    @objc func jqfxhNextBtnClick() {
        
        if !jqfxhAgreellButton.isSelected {
            JQFXHHUD.jqfxhShowxxText("请阅读并同意贷款条款")
            return

        }
        
        if let address = self.jqfxhCityiiContent.text {
            if address.isEmpty || address == "选择城市>"{
                JQFXHHUD.jqfxhShowxxText("请填写地址信息")
                return
            }
        }

        if let name = self.jqfxhNamezzTf.text {
            if name.isEmpty {
                JQFXHHUD.jqfxhShowxxText("请填写姓名")
                return
            }else if (name.count < 2) {
                JQFXHHUD.jqfxhShowxxText("姓名至少需要2个字符")
                return
            }
        }
        
        if  !self.jqfxhIsValidIDNumber(self.jqfxhIdNumbbTf.text ?? "") {
            JQFXHHUD.jqfxhShowxxText("请填写正确的身份证号")
            return
        }
        
        if let mobile = self.jqfxhMobilettTF.text {
            if mobile.isEmpty {
                JQFXHHUD.jqfxhShowxxText("请填写手机号")
                return
            }
        }
        
        if JQFXHNetworkManager.shared.partnerId == 6 {
            self.jqfxhPartta["realname"] = self.jqfxhNamezzTf.text
            self.jqfxhPartta["id_card_no"] = self.jqfxhIdNumbbTf.text
        }else if JQFXHNetworkManager.shared.partnerId == 3 {
            self.jqfxhPartta["name"] = self.jqfxhNamezzTf.text
            self.jqfxhPartta["idCardNo"] = self.jqfxhIdNumbbTf.text
        }else {
            self.jqfxhPartta["real_name"] = self.jqfxhNamezzTf.text
            self.jqfxhPartta["id_number"] = self.jqfxhIdNumbbTf.text
            self.jqfxhPartta["mobile"] = self.jqfxhMobilettTF.text
        }
        
        if JQFXHNetworkManager.shared.partnerId == 6 {
            let loanvc = JQFXHMoliLoanSubmitxxViewController(para: jqfxhPartta)
            self.navigationController?.pushViewController(loanvc, animated: true)
        }else {
            let loanvc = JQFXHLoanSubmitmmViewController.init(para: jqfxhPartta)
            self.navigationController?.pushViewController(loanvc, animated: true)
        }
        

        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "申请借款"
        self.view.backgroundColor = UIColor.jqfxhSmallViewBgbbGray
        self.jqfxhIsNavBarjjHidden = true
        let json = "jqfxhLoanlistTop"
    
        
        guard let url = Bundle.main.url(forResource: json, withExtension: "json"),
              let data = try? Data(contentsOf: url) else {
            return
        }
        do {
            let jqfxhListqqData = try CleanJSONDecoder().decode(JQFXHLoanvvListModel.self, from: data)
            self.jqfxhListoos = jqfxhListqqData.array
        } catch {
        }
        self.jqfxhSetupuuSubviews()

    }
    
    @objc func jqfxhDoneTapped() {
        view.endEditing(true) // 收起键盘
    }
    
    
        
    func jqfxhSetupuuSubviews() -> Void {
        
        self.view.addSubview(jqfxhTopBgxxImg)
        jqfxhTopBgxxImg.snp.makeConstraints { make in
            make.left.right.top.equalTo(self.view)
        }
        

        self.view.addSubview(jqfxhBackyyBtn)
        jqfxhBackyyBtn.snp.makeConstraints { make in
            make.left.equalTo(self.view).offset(20)
            make.top.equalTo(self.view).offset(UIApplication.shared.jqfxhSafeAreaInsets.top + 20)
            make.width.height.equalTo(30)
        }
        
        
        self.view.addSubview(jqfxhCalNavTitlebbLabel)
        jqfxhCalNavTitlebbLabel.snp.makeConstraints { make in
            make.centerY.equalTo(jqfxhBackyyBtn)
            make.centerX.equalTo(self.view)
        }
        
        self.view.addSubview(jqfxhScrollggview)
        jqfxhScrollggview.addSubview(jqfxhContentkkView)
        jqfxhScrollggview.snp.makeConstraints { make in
            make.left.right.equalTo(self.view)
            make.top.equalTo(jqfxhCalNavTitlebbLabel.snp.bottom).offset(20)
            make.bottom.equalTo(self.view).offset(-UIApplication.shared.jqfxhSafeAreaInsets.bottom-80)
        }
        
        jqfxhContentkkView.snp.makeConstraints { make in
            make.left.right.equalTo(self.view)
            make.top.bottom.equalTo(jqfxhScrollggview)
        }
        
        
        jqfxhContentkkView.addSubview(jqfxhTowwpViewBg)
        jqfxhTowwpViewBg.snp.makeConstraints { make in
            make.left.equalTo(self.view).offset(16)
            make.centerX.equalTo(self.view)
            make.top.equalTo(jqfxhContentkkView)
            make.height.equalTo(290)
        }
        
        jqfxhContentkkView.addSubview(jqfxhCenteryyViewBg)
        jqfxhCenteryyViewBg.snp.makeConstraints { make in
            make.left.equalTo(self.view).offset(16)
            make.centerX.equalTo(self.view)
            make.top.equalTo(jqfxhTowwpViewBg.snp.bottom).offset(20)
            make.height.equalTo(125)
        }
                
        
        jqfxhContentkkView.addSubview(jqfxhBottomxxViewBg)
        jqfxhBottomxxViewBg.snp.makeConstraints { make in
            make.left.right.equalTo(jqfxhTowwpViewBg)
            make.top.equalTo(jqfxhCenteryyViewBg.snp.bottom).offset(18)
            make.height.equalTo(300)
            make.bottom.equalTo(jqfxhContentkkView)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhJibenyyTitleLabel)
        jqfxhJibenyyTitleLabel.snp.makeConstraints { make in
            make.left.top.equalTo(jqfxhTowwpViewBg).offset(12)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhRealNameyyTitleLabel)
        jqfxhRealNameyyTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(jqfxhJibenyyTitleLabel)
            make.top.equalTo(jqfxhJibenyyTitleLabel.snp.bottom).offset(15)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhNamevvBg)
        jqfxhNamevvBg.snp.makeConstraints { make in
            make.left.equalTo(jqfxhJibenyyTitleLabel)
            make.centerX.equalTo(jqfxhTowwpViewBg)
            make.top.equalTo(jqfxhRealNameyyTitleLabel.snp.bottom).offset(4)
            make.height.equalTo(44)
        }
        
        jqfxhNamevvBg.addSubview(jqfxhNamezzTf)
        jqfxhNamezzTf.snp.makeConstraints { make in
            make.left.equalTo(jqfxhNamevvBg).offset(15)
            make.centerX.equalTo(jqfxhNamevvBg)
            make.top.bottom.equalTo(jqfxhNamevvBg)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhIdNumTitleaaLabel)
        jqfxhIdNumTitleaaLabel.snp.makeConstraints { make in
            make.left.equalTo(jqfxhRealNameyyTitleLabel)
            make.top.equalTo(jqfxhNamevvBg.snp.bottom).offset(12)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhIdNowwBg)
        jqfxhIdNowwBg.snp.makeConstraints { make in
            make.left.equalTo(jqfxhJibenyyTitleLabel)
            make.centerX.equalTo(jqfxhTowwpViewBg)
            make.top.equalTo(jqfxhIdNumTitleaaLabel.snp.bottom).offset(4)
            make.height.equalTo(44)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhIdNumbbTf)
        jqfxhIdNumbbTf.snp.makeConstraints { make in
            make.left.equalTo(jqfxhIdNowwBg).offset(15)
            make.centerX.equalTo(jqfxhIdNowwBg)
            make.top.bottom.equalTo(jqfxhIdNowwBg)
        }
        
        
        jqfxhTowwpViewBg.addSubview(jqfxhMobilessLabel)
        jqfxhMobilessLabel.snp.makeConstraints { make in
            make.left.equalTo(jqfxhRealNameyyTitleLabel)
            make.top.equalTo(jqfxhIdNowwBg.snp.bottom).offset(12)
        }
        
        jqfxhTowwpViewBg.addSubview(jqfxhMobileuuBg)
        jqfxhMobileuuBg.snp.makeConstraints { make in
            make.left.equalTo(jqfxhJibenyyTitleLabel)
            make.centerX.equalTo(jqfxhTowwpViewBg)
            make.top.equalTo(jqfxhMobilessLabel.snp.bottom).offset(4)
            make.height.equalTo(44)
        }
        
        jqfxhMobileuuBg.addSubview(jqfxhMobilettTF)
        jqfxhMobilettTF.snp.makeConstraints { make in
            make.left.equalTo(jqfxhMobileuuBg).offset(15)
            make.centerX.equalTo(jqfxhMobileuuBg)
            make.top.bottom.equalTo(jqfxhMobileuuBg)
        }
        
        
        jqfxhCenteryyViewBg.addSubview(jqfxhCityzzBigTitleLabel)
        jqfxhCityzzBigTitleLabel.snp.makeConstraints { make in
            make.left.top.equalTo(jqfxhCenteryyViewBg).offset(12)
        }
        
        jqfxhCenteryyViewBg.addSubview(jqfxhCitybbTitleLabel)
        jqfxhCitybbTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(jqfxhCityzzBigTitleLabel)
            make.top.equalTo(jqfxhCityzzBigTitleLabel.snp.bottom).offset(12)
        }
        
        jqfxhCenteryyViewBg.addSubview(jqfxhCityccContentBg)
        jqfxhCityccContentBg.snp.makeConstraints { make in
            make.left.equalTo(jqfxhCityzzBigTitleLabel)
            make.centerX.equalTo(jqfxhCenteryyViewBg)
            make.top.equalTo(jqfxhCitybbTitleLabel.snp.bottom).offset(4)
            make.height.equalTo(44)
        }
        
        jqfxhCityccContentBg.addSubview(jqfxhCityiiContent)
        jqfxhCityiiContent.snp.makeConstraints { make in
            make.left.equalTo(jqfxhCityccContentBg).offset(15)
            make.centerX.equalTo(jqfxhCityccContentBg)
            make.top.bottom.equalTo(jqfxhCityccContentBg)
        }
        
        let ges = UITapGestureRecognizer(target: self, action: #selector(jqfxhSelectyyCity))
        jqfxhCenteryyViewBg.addGestureRecognizer(ges)
        
        
        jqfxhBottomxxViewBg.addSubview(jqfxhDaikuanddTitleLabel)
        jqfxhDaikuanddTitleLabel.snp.makeConstraints { make in
            make.left.top.equalTo(jqfxhBottomxxViewBg).offset(12)
        }
        
        jqfxhBottomxxViewBg.addSubview(jqfxhCollectionvvView)
        jqfxhCollectionvvView.snp.makeConstraints { make in
            make.top.equalTo(jqfxhDaikuanddTitleLabel.snp.bottom).offset(12)
            make.left.right.bottom.equalTo(jqfxhBottomxxViewBg)
        }
        
        self.view.addSubview(jqfxhNextButton)
        jqfxhNextButton.snp.makeConstraints { make in
            make.left.equalTo(self.view).offset(28)
            make.right.equalTo(self.view).offset(-28)
            make.top.equalTo(jqfxhScrollggview.snp.bottom).offset(40)
            make.height.equalTo(42)
        }
        
        self.view.addSubview(jqfxhAgreellButton)
        jqfxhAgreellButton.snp.makeConstraints { make in
            make.left.equalTo(self.view).offset(15)
            make.bottom.equalTo(jqfxhNextButton.snp.top).offset(-10)
        }

        self.view.addSubview(jqfxhLogmmTitle)
        jqfxhLogmmTitle.snp.makeConstraints { make in
            make.centerY.equalTo(jqfxhAgreellButton)
            make.left.equalTo(jqfxhAgreellButton.snp.right).offset(1)
        }
        
        self.view.addSubview(jqfxhZhunnceBtn)
        
        jqfxhZhunnceBtn.snp.makeConstraints { make in
            make.centerY.equalTo(jqfxhAgreellButton)
            make.left.equalTo(jqfxhLogmmTitle.snp.right).offset(1)
        }

            

    }
    
    private lazy var jqfxhLayoutaa: UICollectionViewFlowLayout = {
        let jqfxhLayoutaa = UICollectionViewFlowLayout()
        jqfxhLayoutaa.minimumInteritemSpacing = 12
        jqfxhLayoutaa.scrollDirection = .vertical
        jqfxhLayoutaa.minimumLineSpacing = 12
        jqfxhLayoutaa.itemSize = CGSize(width: (jqfxhScreenWidth-56-32)/3, height: 26)
        jqfxhLayoutaa.sectionInset = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 12)
        return jqfxhLayoutaa
    }()
    
    
    public lazy var jqfxhCollectionvvView: UICollectionView = {
        
        let jqfxhCollectionvvView = UICollectionView(frame: .zero, collectionViewLayout: self.jqfxhLayoutaa)
                        
        jqfxhCollectionvvView.register(JQFXHLoanSectionyyHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: JQFXHLoanSectionyyHeaderId)
        jqfxhCollectionvvView.register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "foot")
        jqfxhCollectionvvView.register(JQFXHLoanSectioneeFooter.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: JQFXHLoanSectioneeFooterId)
        jqfxhCollectionvvView.register(JQFXHLoanItemwwCell.self, forCellWithReuseIdentifier: JQFXHLoanItemwwCellId)
        
        jqfxhCollectionvvView.backgroundColor = UIColor.white
        jqfxhCollectionvvView.showsVerticalScrollIndicator = false
        jqfxhCollectionvvView.showsHorizontalScrollIndicator = false
        jqfxhCollectionvvView.keyboardDismissMode = .onDrag  // 在拖动时隐藏键盘

        jqfxhCollectionvvView.layer.cornerRadius = 12
        jqfxhCollectionvvView.layer.masksToBounds = true

        if #available(iOS 11.0, *) {
            jqfxhCollectionvvView.contentInsetAdjustmentBehavior = .never
        }
        jqfxhCollectionvvView.isScrollEnabled = false
        jqfxhCollectionvvView.alwaysBounceVertical = true
        jqfxhCollectionvvView.delegate = self
        jqfxhCollectionvvView.dataSource = self
        return jqfxhCollectionvvView
    }()
    
    @objc func jqfxhSelectyyCity() {
        if JQFXHNetworkManager.shared.partnerId == 3 {
            let jqfxhPicker = JQFXHShengrAdressPickerViewController()
            jqfxhPicker.jqfxhAddresskkBlock = {[weak self] addressString, lastCode in
                guard let self else { return }
                self.jqfxhPartta["cityOfWork"] = addressString
                self.jqfxhPartta["cityOfWorkCode"] = String(lastCode)
                self.jqfxhCityiiContent.text = addressString
            }
            self.navigationController?.present(jqfxhPicker, animated: true)
            
        }else if JQFXHNetworkManager.shared.partnerId == 6 {
            let jqfxhPicker = JQFXHMoliAdressPickerViewController()
            jqfxhPicker.jqfxhAddresskkBlock = {[weak self] addressString, lastCode in
                guard let self else { return }
                self.jqfxhPartta["current_district_id"] = String(lastCode)
                self.jqfxhCityiiContent.text = addressString
            }
            self.navigationController?.present(jqfxhPicker, animated: true)
        }else {
            let jqfxhPicker = JQFXHAddressPickerViewController()
            jqfxhPicker.jqfxhAddresskkBlock = {[weak self] privince, city, area in
                guard let self else { return }
                self.jqfxhCityiiContent.text = privince + city + area
                self.jqfxhPartta["work_city"] = city + area
            }
            self.navigationController?.present(jqfxhPicker, animated: true)
        }
        
    }
    
    public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return self.jqfxhListoos[section].list.count
    }
    
    public func numberOfSections(in collectionView: UICollectionView) -> Int {
        self.jqfxhListoos.count
    }
    
    
    
    public func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {

        if kind == UICollectionView.elementKindSectionHeader {
            
            let head = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: JQFXHLoanSectionyyHeaderId, for: indexPath) as! JQFXHLoanSectionyyHeader
            head.updateWithSectionModel(model: self.jqfxhListoos[indexPath.section])
            return head
           
            
        }else{

            let footerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "foot", for: indexPath)
            return footerView
        }
    }
    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
        
        return CGSize(width: jqfxhScreenWidth-36-32, height:45)
        
    }
    
    
    
    
    public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: JQFXHLoanItemwwCellId, for: indexPath) as! JQFXHLoanItemwwCell
        cell.jqfxhUpdateWithItemxxModel(model: self.jqfxhListoos[indexPath.section].list[indexPath.item])
        return cell
        
    }
    
    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
        
        if section == self.jqfxhListoos.count-1 {
            if JQFXHNetworkManager.shared.partnerId == 3 {
                return CGSize(width: jqfxhScreenWidth, height: 100)
            }
            return CGSize(width: jqfxhScreenWidth, height: 16)

        }
        return CGSize(width: jqfxhScreenWidth, height: CGFLOAT_MIN)
    }
    
    
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) -> Void {
        var sectionModel = self.jqfxhListoos[indexPath.section]
        for index in 0..<sectionModel.list.count{
            var itemModel = sectionModel.list[index]
            if index == indexPath.row {
                itemModel.isSlected = true
                jqfxhPartta[sectionModel.key] = itemModel.itemId
            }else {
                itemModel.isSlected = false
            }
            sectionModel.list[index] = itemModel
        }
        self.jqfxhListoos[indexPath.section] = sectionModel
        self.jqfxhCollectionvvView.reloadData()
    }
    
    
    @objc func jqfxhAgreellButtonClick() {
        jqfxhAgreellButton.isSelected = !jqfxhAgreellButton.isSelected
    }
    
    @objc func jqfxhZhunnpqceBtnClick() -> Void {
        let web = JQFXHTermsViewController.init()
        self.present(web, animated: true)
    }
    
    lazy var jqfxhScrollggview : UIScrollView = {
        let jqfxhScrollggview = UIScrollView(frame: CGRectMake(0, 0, jqfxhScreenWidth, jqfxhScreenHeight))
        if #available(iOS 11.0, *) {
            jqfxhScrollggview.contentInsetAdjustmentBehavior = .never
        } else {
        }
        return jqfxhScrollggview
    }()
    
    lazy var jqfxhContentkkView : UIView = {
        let jqfxhContentkkView = UIView()
        
        return jqfxhContentkkView
    }()
    
    lazy var jqfxhLogmmTitle : UILabel = {
        let jqfxhLogmmTitle = UILabel()
        //登录即代表同意《注册协议》《隐私协议》
        jqfxhLogmmTitle.font = UIFont.jqfxhRegular12
        jqfxhLogmmTitle.textColor = UIColor.black
        jqfxhLogmmTitle.text = "已阅读并同意"
        return jqfxhLogmmTitle
    }()
    
    lazy var jqfxhZhunnceBtn : UIButton = {
        let jqfxhZhunnceBtn = UIButton(type: .custom)
        jqfxhZhunnceBtn.setTitle("《贷款条款》", for: .normal)
        jqfxhZhunnceBtn.setTitleColor(UIColor.jqfxhThemexxRed, for: .normal)
        jqfxhZhunnceBtn.titleLabel?.font = UIFont.jqfxhRegular12
        jqfxhZhunnceBtn.addTarget(self, action: #selector(jqfxhZhunnpqceBtnClick), for: .touchUpInside)
        return jqfxhZhunnceBtn
    }()
    
    lazy var jqfxhAgreellButton: UIButton = {
        let jqfxhAgreellButton = UIButton(type: .custom)
        jqfxhAgreellButton.setImage(UIImage(named: "jqfxh_no_agree"), for: .normal)
        jqfxhAgreellButton.setImage(UIImage(named: "jqfxh_agree"), for: .selected)
        var configuration = UIButton.Configuration.plain()
        configuration.contentInsets = NSDirectionalEdgeInsets(top: 2, leading: 10, bottom: 2, trailing: 5)
        jqfxhAgreellButton.configuration = configuration
        jqfxhAgreellButton.tintColor = .clear  // 去掉选中时的蓝色背景
        jqfxhAgreellButton.addTarget(self, action: #selector(jqfxhAgreellButtonClick), for: .touchUpInside)
        return jqfxhAgreellButton
    }()
    
    
    @objc func jqfxhBackyyBtnClick() {
        self.navigationController?.popViewController(animated: true)
    }
    
    
    lazy var jqfxhBackyyBtn: UIButton = {
        let jqfxhBackyyBtn = UIButton(type: .custom)
        jqfxhBackyyBtn.setBackgroundImage(UIImage(named: "jqfxh_nav_white_back"), for: .normal)
        jqfxhBackyyBtn.addTarget(self, action: #selector(jqfxhBackyyBtnClick), for: .touchUpInside)
        return jqfxhBackyyBtn
    }()
    
    lazy var jqfxhTopBgxxImg : UIImageView = {
        let jqfxhTopBgxxImg = UIImageView(image: UIImage(named: "jqfxh_home_top"))
        jqfxhTopBgxxImg.isUserInteractionEnabled = true
        return jqfxhTopBgxxImg
    }()
    
    
    lazy var jqfxhCalNavTitlebbLabel : UILabel = {
        let jqfxhCalNavTitlebbLabel = UILabel()
        jqfxhCalNavTitlebbLabel.font = UIFont.jqfxhRegular18
        jqfxhCalNavTitlebbLabel.textColor = UIColor.white
        jqfxhCalNavTitlebbLabel.text = "申请借款"
        return jqfxhCalNavTitlebbLabel
    }()
    
    
    private lazy var jqfxhTowwpViewBg : UIView = {
        let jqfxhTowwpViewBg = UIView()
        jqfxhTowwpViewBg.backgroundColor = UIColor.white
        jqfxhTowwpViewBg.layer.cornerRadius = 8
        jqfxhTowwpViewBg.layer.masksToBounds = true
        return jqfxhTowwpViewBg
    }()
    
    private lazy var jqfxhCenteryyViewBg : UIView = {
        let jqfxhCenteryyViewBg = UIView()
        jqfxhCenteryyViewBg.backgroundColor = UIColor.white
        jqfxhCenteryyViewBg.layer.cornerRadius = 8
        jqfxhCenteryyViewBg.layer.masksToBounds = true
        return jqfxhCenteryyViewBg
    }()
    
    
    private lazy var jqfxhBottomxxViewBg : UIView = {
        let jqfxhBottomxxViewBg = UIView()
        jqfxhBottomxxViewBg.backgroundColor = UIColor.white
        jqfxhBottomxxViewBg.layer.cornerRadius = 8
        jqfxhBottomxxViewBg.layer.masksToBounds = true
        return jqfxhBottomxxViewBg
    }()
    
    private lazy var jqfxhNamevvBg : UIView = {
        let jqfxhNamevvBg = UIView()
        jqfxhNamevvBg.backgroundColor = UIColor.jqfxhSmallViewBgbbGray
        jqfxhNamevvBg.layer.cornerRadius = 8
        jqfxhNamevvBg.layer.masksToBounds = true
        return jqfxhNamevvBg
    }()
    
    private lazy var jqfxhIdNowwBg : UIView = {
        let jqfxhIdNowwBg = UIView()
        jqfxhIdNowwBg.backgroundColor = UIColor.jqfxhSmallViewBgbbGray
        jqfxhIdNowwBg.layer.cornerRadius = 8
        jqfxhIdNowwBg.layer.masksToBounds = true
        return jqfxhIdNowwBg
    }()
    
    private lazy var jqfxhMobileuuBg : UIView = {
        let jqfxhMobileuuBg = UIView()
        jqfxhMobileuuBg.backgroundColor = UIColor.jqfxhSmallViewBgbbGray
        jqfxhMobileuuBg.layer.cornerRadius = 8
        jqfxhMobileuuBg.layer.masksToBounds = true
        return jqfxhMobileuuBg
    }()
    
    
    lazy var jqfxhNextButton: UIButton = {
        let button = UIButton(type: .system)
        button.setTitle("下一步", for: .normal)
        button.backgroundColor = UIColor.jqfxhThemexxRed
        button.setTitleColor(.white, for: .normal)
        button.layer.cornerRadius = 8
        button.addTarget(self, action: #selector(jqfxhNextBtnClick), for: .touchUpInside)
        return button
    }()
    

    

    
    lazy var jqfxhLinexxView : UIView = {
        let jqfxhLinexxView = UIView()
        jqfxhLinexxView.backgroundColor = UIColor.jqfxhLineyyGray
        return jqfxhLinexxView
    }()
    
    
    lazy var jqfxhJibenyyTitleLabel : UILabel = {
        let jqfxhJibenyyTitleLabel = UILabel()
        jqfxhJibenyyTitleLabel.font = UIFont.jqfxhMedium16
        jqfxhJibenyyTitleLabel.textColor = UIColor.black
        jqfxhJibenyyTitleLabel.text = "请填写基本信息"
        return jqfxhJibenyyTitleLabel
    }()
    
    
    lazy var jqfxhDaikuanddTitleLabel : UILabel = {
        let jqfxhDaikuanddTitleLabel = UILabel()
        jqfxhDaikuanddTitleLabel.font = UIFont.jqfxhMedium16
        jqfxhDaikuanddTitleLabel.textColor = UIColor.black
        jqfxhDaikuanddTitleLabel.text = "请填写贷款信息"
        return jqfxhDaikuanddTitleLabel
    }()
    
    
    lazy var jqfxhRealNameyyTitleLabel : UILabel = {
        let jqfxhRealNameyyTitleLabel = UILabel()
        jqfxhRealNameyyTitleLabel.font = UIFont.jqfxhRegular14
        jqfxhRealNameyyTitleLabel.textColor = UIColor.black
        jqfxhRealNameyyTitleLabel.text = "姓名"
        return jqfxhRealNameyyTitleLabel
    }()
    
    lazy var jqfxhCityzzBigTitleLabel : UILabel = {
        let jqfxhCityzzTitleLabel = UILabel()
        jqfxhCityzzTitleLabel.font = UIFont.jqfxhMedium16
        jqfxhCityzzTitleLabel.textColor = UIColor.black
        jqfxhCityzzTitleLabel.text = "请填写居住信息"
        return jqfxhCityzzTitleLabel
    }()
    
    lazy var jqfxhCitybbTitleLabel : UILabel = {
        let jqfxhCitybbTitleLabel = UILabel()
        jqfxhCitybbTitleLabel.font = UIFont.jqfxhRegular14
        jqfxhCitybbTitleLabel.textColor = UIColor.black
        jqfxhCitybbTitleLabel.text = "长期居住城市"
        return jqfxhCitybbTitleLabel
    }()
    
    lazy var jqfxhCityccContentBg : UIView = {
        let jqfxhCityccContentBg = UIView()
        jqfxhCityccContentBg.backgroundColor = UIColor.jqfxhSmallViewBgbbGray
        jqfxhCityccContentBg.layer.cornerRadius = 8
        jqfxhCityccContentBg.layer.masksToBounds = true
        
        return jqfxhCityccContentBg
    }()
    
    lazy var jqfxhCityiiContent : UILabel = {
        let jqfxhCityiiContent = UILabel()
        jqfxhCityiiContent.font = UIFont.jqfxhRegular14
        jqfxhCityiiContent.textColor = UIColor.lightGray
        jqfxhCityiiContent.text = "选择城市>"
        return jqfxhCityiiContent
    }()
    
   
    
    lazy var jqfxhIdNumTitleaaLabel : UILabel = {
        let jqfxhIdNumTitleaaLabel = UILabel()
        jqfxhIdNumTitleaaLabel.font = UIFont.jqfxhRegular14
        jqfxhIdNumTitleaaLabel.textColor = UIColor.black
        jqfxhIdNumTitleaaLabel.text = "身份证号"

        return jqfxhIdNumTitleaaLabel
    }()
    
    lazy var jqfxhNamezzTf : UITextField = {
        let jqfxhNamezzTf = UITextField()
        jqfxhNamezzTf.font = UIFont.jqfxhRegular14
        jqfxhNamezzTf.placeholder = "请输入本人真实姓名"
        jqfxhNamezzTf.returnKeyType = .done
        jqfxhNamezzTf.delegate = self
        jqfxhNamezzTf.jqfxhAddDoneButtoneeOnKeyboard(target: self, action: #selector(jqfxhDoneTapped))

        return jqfxhNamezzTf
    }()
    
    
    lazy var jqfxhIdNumbbTf : UITextField = {
        let jqfxhIdNumbbTf = UITextField()
        jqfxhIdNumbbTf.font = UIFont.jqfxhRegular14
        jqfxhIdNumbbTf.placeholder = "请输入本人身份证号"
        jqfxhIdNumbbTf.returnKeyType = .done
        jqfxhIdNumbbTf.delegate = self
        jqfxhIdNumbbTf.jqfxhAddDoneButtoneeOnKeyboard(target: self, action: #selector(jqfxhDoneTapped))

        return jqfxhIdNumbbTf
    }()
    
    lazy var jqfxhMobilessLabel : UILabel = {
        let jqfxhMobilessLabel = UILabel()
        jqfxhMobilessLabel.font = UIFont.jqfxhRegular14
        jqfxhMobilessLabel.textColor = UIColor.black
        jqfxhMobilessLabel.text = "手机号"

        return jqfxhMobilessLabel
    }()
    
    lazy var jqfxhMobilettTF : UITextField = {
        let jqfxhMobilettTF = UITextField()
        jqfxhMobilettTF.font = UIFont.jqfxhRegular14
        jqfxhMobilettTF.placeholder = "请输入您的手机号码"
        jqfxhMobilettTF.returnKeyType = .done
        jqfxhMobilettTF.delegate = self
        jqfxhMobilettTF.keyboardType = .numberPad
        jqfxhMobilettTF.jqfxhAddDoneButtoneeOnKeyboard(target: self, action: #selector(jqfxhDoneTapped))

        return jqfxhMobilettTF
    }()
    
    
}

extension JQFXHRealNamessViewController : UITextFieldDelegate {
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        return true
    }
}
